public class SpinLock {
    private Thread owner = null;
    public void lock(){
        while(!CAS(this.owner, null, Thread.currentThread())){
        }
    }
    public void unlock () {
        this.owner = null;
    }
}
